<!DOCTYPE html>
<html>
<head>
    <meta charset="utf-8">
    <title>标题</title>
    <meta name="renderer" content="webkit">
    <meta http-equiv="X-UA-Compatible" content="IE=edge,chrome=1">
    <meta name="viewport" content="width=device-width, initial-scale=1, maximum-scale=1">
    <link rel="stylesheet" href="/lib/layui/css/layui.css">
    <!-- 注意：如果你直接复制所有代码到本地，上述css路径需要改成你本地的 -->
</head>
<body>
<form class="layui-form searchForm">
    <div class="layui-form-item">
        <div class="layui-inline">
            <label class="layui-form-label" style="width: 100px;">发送人：</label>
            <div class="layui-input-inline">
                <input type="text" name="sender" id="sender" autocomplete="off" class="layui-input">
            </div>
        </div>
        <div class="layui-inline">
            <label class="layui-form-label" style="width: 100px;">接收人：</label>
            <div class="layui-input-inline">
                <input type="text" name="receiver" id="receiver" autocomplete="off" class="layui-input">
            </div>
        </div>
        <div class="layui-inline">
            <div class="layui-input-inline">
                <button class="layui-btn layui-btn-normal" id="queryBut">搜索</button>
            </div>
        </div>
    </div>
</form>
<table class="layui-hide" id="dataList" lay-filter="dataList"></table>


<script type="text/html" id="barDemo">
    <a class="layui-btn layui-btn-sm layui-btn-xs" lay-event="edit">生成代码</a>
</script>

<script type="text/javascript" src="/lib/layui/layui.js"></script>
<script src="/static/js/main.js"></script>
<script>
    var configureCom = {};
    layui.use(['jquery', 'configureCom', 'configure', 'sessionFun', 'table', 'matchDict'], function () {
        var $ = layui.jquery;
        var configure = layui.configure;
        var table = layui.table;
        var sessionFun = layui.sessionFun;
        configureCom = layui.configureCom;
        var cols = [[
            {field: 'tableName', title: '表名',width:'200'},
            {field: 'engine', title: '引擎方式',width:'180'},
            {field: 'tableComment', title: '表注释',width:'180'},
            {field: 'createTime', title: '创建时间',width:'180'},
            {fixed: 'right', title: '操作', toolbar: '#barDemo', width: 150}
        ]];
        configureCom.tableRender(configure.GEN_HTTP_LIST, {}, cols, 'dataList', 10, 'full-200', 'toolbarOrg');
        //每行操作
        table.on('tool(dataList)', function (obj) {
            var data = obj.data.tableName;
            sessionFun.set(configure.SESSION_LIST_DATA, data);
            if (obj.event === 'edit') {//代码生成
                editItem("代码生成",configure.GEN_HTTP_CODE);
            }
        });
        //代码生成
        function editItem(title, url) {
            top.layer.open({
                type: 2,
                title: title,
                area: configureCom.Psize3,
                content: configureCom.nocache(configure.GEN_HTML_CODE),
                btn: ['代码生成'],
                yes: function (index, layero) {
                    var iframeWin = top.window.frames['layui-layer-iframe' + index]; //得到iframe页的窗口对
                    iframeWin.getData();//直接提交即可
                    top.layer.close(index);
                }
            });
        }

    });

</script>
</body>
</html>